package com.ujoku.request.admin;

import com.labillusion.core.platform.web.pagination.PaginationForm;
import com.labillusion.core.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Greg.Chen on 2015/1/15.
 */
public class GoodsPaginationForm extends PaginationForm {
    private String goods_name;
    private String wineryId;
    private String country;
    private String cate_id_1;
    private String cate_id_2;
    private Boolean isNew;
    private Boolean sales;
    private Boolean recommended;

    public Boolean getRecommended() {
        return recommended;
    }

    public void setRecommended(Boolean recommended) {
        this.recommended = recommended;
    }

    public Boolean getSales() {
        return sales;
    }

    public void setSales(Boolean sales) {
        this.sales = sales;
    }

    public Boolean getIsNew() {
        return isNew;
    }

    public void setIsNew(Boolean isNew) {
        this.isNew = isNew;
    }

    public String getCate_id_1() {
        return cate_id_1;
    }

    public void setCate_id_1(String cate_id_1) {
        this.cate_id_1 = cate_id_1;
    }

    public String getCate_id_2() {
        return cate_id_2;
    }

    public void setCate_id_2(String cate_id_2) {
        this.cate_id_2 = cate_id_2;
    }

    public String getWineryId() {
        return wineryId;
    }

    public void setWineryId(String wineryId) {
        this.wineryId = wineryId;
    }

    public String getGoods_name() {
        return goods_name;
    }

    public void setGoods_name(String goods_name) {
        this.goods_name = goods_name;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    @Override
    public Map<String, Object> getQueryMap(){
        Map<String, Object> query = super.getQueryMap();
        if(StringUtils.hasText(this.getGoods_name()))
            query.put("goods_name",this.getGoods_name());

        if(StringUtils.hasText(this.getWineryId()))
            query.put("wineryId",this.getWineryId());

        if(StringUtils.hasText(this.getCountry()))
            query.put("country",this.getCountry());

        if(StringUtils.hasText(this.getCate_id_1()))
            query.put("cate_id_1",this.getCate_id_1());

        if(StringUtils.hasText(this.getCate_id_2()))
            query.put("cate_id_2",this.getCate_id_2());

        if(isNew != null)
            query.put("isNew",this.getIsNew());
        if(sales != null)
            query.put("sales",this.getSales());
        if(recommended != null)
            query.put("recommended",this.getRecommended());


        return query;
    }
}
